package com.hdsx.netty.rpcclient.netty.handle;

import com.hdsx.netty.protocol.BasicProtocol;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

import java.lang.reflect.Method;

/**
 * @author 占贤银
 * time 2024/8/14 21:38
 * description 生命之灯因热情而点燃，生命之舟因拼搏而前行
 */
public class RpcClientHandler extends ChannelInboundHandlerAdapter {

    private Object response;

    public Object getResponse() {
        return response;
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
        this.response = msg;
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx)
    {
        ctx.close();
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
    {
        ctx.close();
    }
}